From 7ead2e2ed9045f9e2f8aac02cc27d5fc682269db Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 8 Mar 2005 13:47:08 +0000 Subject: [PATCH] bitkeeper revision 1.1236.12.7 (422dacdcZEjp_SXRvSpRKap0KtkBag) Must always send VIRQ_TIMER to a blocked guest. Signed-off-by: Keir Fraser --- xen/arch/x86/time.c | 17 +++++++++-------- xen/common/schedule.c | 11 ++++++----- xen/include/xen/time.h | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 0bd051954f..208945ca33 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -296,17 +296,18 @@ static inline void __update_dom_time(struct exec_domain *ed) spin_unlock(&d->time_lock); } -void update_dom_time(struct exec_domain *ed) +int update_dom_time(struct exec_domain *ed) { unsigned long flags; - if ( ed->domain->shared_info->tsc_timestamp != full_tsc_irq ) - { - read_lock_irqsave(&time_lock, flags); - __update_dom_time(ed); - read_unlock_irqrestore(&time_lock, flags); - send_guest_virq(ed, VIRQ_TIMER); - } + if ( ed->domain->shared_info->tsc_timestamp == full_tsc_irq ) + return 0; + + read_lock_irqsave(&time_lock, flags); + __update_dom_time(ed); + read_unlock_irqrestore(&time_lock, flags); + + return 1; } /* Set clock to after 00:00:00 UTC, 1 January, 1970. */ diff --git a/xen/common/schedule.c b/xen/common/schedule.c index a0cd4303c2..be85ec9a89 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -457,8 +457,8 @@ void __enter_scheduler(void) clear_bit(EDF_RUNNING, &prev->ed_flags); /* Ensure that the domain has an up-to-date time base. */ - if ( !is_idle_task(next->domain) ) - update_dom_time(next); + if ( !is_idle_task(next->domain) && update_dom_time(next) ) + send_guest_virq(next, VIRQ_TIMER); schedule_tail(next); @@ -495,8 +495,8 @@ static void t_timer_fn(unsigned long unused) TRACE_0D(TRC_SCHED_T_TIMER_FN); - if ( !is_idle_task(ed->domain) ) - update_dom_time(ed); + if ( !is_idle_task(ed->domain) && update_dom_time(ed) ) + send_guest_virq(ed, VIRQ_TIMER); t_timer[ed->processor].expires = NOW() + MILLISECS(10); add_ac_timer(&t_timer[ed->processor]); @@ -508,7 +508,8 @@ static void dom_timer_fn(unsigned long data) struct exec_domain *ed = (struct exec_domain *)data; TRACE_0D(TRC_SCHED_DOM_TIMER_FN); - update_dom_time(ed); + (void)update_dom_time(ed); + send_guest_virq(ed, VIRQ_TIMER); } /* Initialise the data structures. */ diff --git a/xen/include/xen/time.h b/xen/include/xen/time.h index 1e7ba6657e..b1eeade753 100644 --- a/xen/include/xen/time.h +++ b/xen/include/xen/time.h @@ -54,7 +54,7 @@ s_time_t get_s_time(void); #define MILLISECS(_ms) (((s_time_t)(_ms)) * 1000000ULL ) #define MICROSECS(_us) (((s_time_t)(_us)) * 1000ULL ) -extern void update_dom_time(struct exec_domain *ed); +extern int update_dom_time(struct exec_domain *ed); extern void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base); -- 2.30.2